var httpSvc = require("./httpSvc");
var cf = require("../utils/config");
var q = require("querystring");
/*
* 请求规范
* @param d  json     请求数据
* @param h  json     请求头
* @param cb function callback函数
*
* */
//乐购主页接口
exports.getMainList = function(d,h,cb){
    var path =cf.path_shop+"/getMainList";
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购主页接口：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购主页接口：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购新品主页接口
exports.getNewMainList = function(d,h,cb){
    var path =cf.path_shop+"/getNewMainList";
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购新品主页接口：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购新品主页接口：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购新品商品列表
exports.getNewProductList = function(d,h,cb){
    var path =cf.path_shop+"/getNewProductList?pageNumber="+d.pageNumber;
    if(d.sortId){
        path+="&sortId="+d.sortId;
    }
    if(d.sortValue){
        path+="&sortValue="+d.sortValue;
    }
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购新品商品列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购新品商品列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购一级分类
exports.getCategoryList = function(d,h,cb){
    var path =cf.path_shop+"/getCategoryList";
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购一级分类：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购一级分类：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购子分类
exports.getSubCategoryList = function(d,h,cb){
    var path =cf.path_shop+"/getSubCategoryList?categoryId="+d.id;
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购子分类：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购子分类：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购子分类商品
exports.getCategoryProductList = function(d,h,cb){
    var path =cf.path_shop+"/getCategoryProductList?pageNumber="+d.pageNumber+"&categoryId="+d.categoryId;
    if(d.sortId){
        path+="&sortId="+d.sortId;
    }
    if(d.sortValue){
        path+="&sortValue="+d.sortValue;
    }
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购子分类商品：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购子分类商品：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购折扣列表
exports.getDiscountsList = function(d,h,cb){
    var path =cf.path_shop+"/getDiscountsList?pageNumber="+d.pageNumber;
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购折扣列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购折扣列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购秒杀列表
exports.getSeckillALLList = function(d,h,cb){
    var path =cf.path_shop+"/getSeckillALLList?pageNumber="+d.pageNumber;
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购秒杀列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购秒杀列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购爆款列表
exports.getLuckyBurstALLList = function(d,h,cb){
    var path =cf.path_shop+"/getLuckyBurstALLList?pageNumber="+d.pageNumber;
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购爆款列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购爆款列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购商品详情
exports.getProductById = function(d,h,cb){
    var path =cf.path_shop+"/getProductById?productId="+d.productId;
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购商品详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购商品详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购商品评价
exports.getProductCommentById = function(d,h,cb){
    var path =cf.path_shop+"/getProductCommentById?productId="+d.productId+"&pageNumber="+d.pageNumber;
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购商品评价：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购商品评价：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};

//爆款商品详情
exports.getLuckyBurstById = function(d,h,cb){
    var path =cf.path_shop+"/getLuckyBurstById?productId="+d.productId;
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("爆款商品详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("爆款商品详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//折扣商品详情
exports.getProductDiscountsById = function(d,h,cb){
    var path =cf.path_shop+"/getProductDiscountsById?productId="+d.productId;
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("折扣商品详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("折扣商品详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//秒杀商品详情
exports.getSeckillById = function(d,h,cb){
    var path =cf.path_shop+"/getSeckillById?productId="+d.productId;
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("秒杀商品详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("秒杀商品详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//商品Sku信息
exports.getProductSkuBySku = function(d,h,cb){
    var path =cf.path_shop+"/getProductSkuBySku?skuId="+d.skuId;
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("商品Sku信息：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("商品Sku信息：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//加入购物车
exports.addCart = function(d,h,cb){
    var path =cf.path_mediaShop+"/addCart?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("加入购物车：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("加入购物车：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//删除购物车
exports.deleteCartByid = function(d,h,cb){
    var path =cf.path_mediaShop+"/deleteCartByid?loginUid="+d.loginUid+"&cartId="+d.cartId;
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("删除购物车：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("删除购物车：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//购物车数量
exports.cartCount = function(d,h,cb){
    var path =cf.path_mediaShop+"/cartCount?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("购物车数量：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("购物车数量：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//购物车列表
exports.cartList = function(d,h,cb){
    var path =cf.path_mediaShop+"/cartList?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("购物车列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("购物车列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//修改购物车数量
exports.updateCart = function(d,h,cb){
    var path =cf.path_mediaShop+"/updateCart?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("修改购物车数量：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("修改购物车数量：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//预下单
exports.preorder = function(d,h,cb){
    var path =cf.path_mediaShop+"/preorder?loginUid="+d.loginUid+"&"+d.cartId;
    if(d.skuProductCouponIdIsIntegral){
        path+="&"+d.skuProductCouponIdIsIntegral;
    }
    if(d.addressId){
        path+="&addressId="+d.addressId;
    }
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("预下单：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("预下单：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//购物车是否加入储物箱
exports.cartIsStorage = function(d,h,cb){
    var path =cf.path_mediaShop+"/cartIsStorage?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("购物车是否加入储物箱：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("购物车是否加入储物箱：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//结算订单
exports.saveOrder = function(d,h,cb){
    var path =cf.path_mediaShop+"/saveOrder?loginUid="+d.loginUid+"&"+d.cartId+"&addressId="+d.addressId;
    if(d.skuProductCouponIdIsIntegral){
        path+="&"+d.skuProductCouponIdIsIntegral;
    }
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("结算订单：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("结算订单：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//支付
exports.payOrder = function(d,h,cb){
    var path =cf.path_mediaShop+"/payOrder?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("支付：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("支付：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//订单列表
exports.userOrderList = function(d,h,cb){
    var path =cf.path_mediaShop+"/userOrderList?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("订单列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("订单列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//订单详情
exports.userOrderInfo = function(d,h,cb){
    var path =cf.path_mediaShop+"/userOrderInfo?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("订单详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("订单详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//订单申请退款
exports.userOrderRefund = function(d,h,cb){
    var path =cf.path_mediaShop+"/userOrderRefund?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("订单申请退款：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("订单申请退款：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//订单申请退款
exports.userOrderRefundAfter = function(d,h,cb){
    var path =cf.path_mediaShop+"/userOrderRefundAfter?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("订单申请退款：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("订单申请退款：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//取消退款
exports.canceluserOrderRefund = function(d,h,cb){
    var path =cf.path_mediaShop+"/canceluserOrderRefund?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("取消退款：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("取消退款：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//取消退货退款
exports.canceluserOrderRefundAndGoods = function(d,h,cb){
    var path =cf.path_mediaShop+"/canceluserOrderRefundAndGoods?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("取消退货退款：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("取消退货退款：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//退货物流
exports.returnLogistics = function(d,h,cb){
    var path =cf.path_mediaShop+"/returnLogistics?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("退货物流：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("退货物流：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//拒绝退货
exports.refuseReturnGoods = function(d,h,cb){
    var path =cf.path_mediaShop+"/refuseReturnGoods?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("拒绝退货：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("拒绝退货：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//买家取消投诉
exports.canceluserOrderComplaint = function(d,h,cb){
    var path =cf.path_mediaShop+"/canceluserOrderComplaint?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("买家取消投诉：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("买家取消投诉：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//物流信息
exports.logisticsInformation = function(d,h,cb){
    var path =cf.path_mediaShop+"/logisticsInformation?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("物流信息：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("物流信息：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//删除订单
exports.deleteuserOrder = function(d,h,cb){
    var path =cf.path_mediaShop+"/deleteuserOrder?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("删除订单：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("删除订单：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//取消订单
exports.canceluserOrder = function(d,h,cb){
    var path =cf.path_mediaShop+"/canceluserOrder?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("取消订单：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("取消订单：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//确认收货
exports.confirmCollectGoods = function(d,h,cb){
    var path =cf.path_mediaShop+"/confirmCollectGoods?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("确认收货：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("确认收货：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//优惠券列表
exports.getCouponsByProductId = function(d,h,cb){
    var path =cf.path_shop+"/getCouponsByProductId?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("优惠券列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("优惠券列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//优惠券详情
exports.getCouponByCouponId = function(d,h,cb){
    var path =cf.path_shop+"/getCouponByCouponId?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("优惠券详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("优惠券详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//购买优惠券
exports.buyCoupon = function(d,h,cb){
    var path =cf.path_shop+"/buyCoupon?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("购买优惠券：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("购买优惠券：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//获取新人专享类型
exports.getNewUserVip = function(d,h,cb){
    var path =cf.path_shop+"/getNewUserVip";
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("获取新人专享类型：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("获取新人专享类型：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//获取新人专享类型-列表
exports.getNewUserVipList = function(d,h,cb){
    var path =cf.path_shop+"/getNewUserVipList?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("获取新人专享类型-列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("获取新人专享类型-列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//获取新人专享优惠券详情
exports.getNewUserVipCouponByCouponId = function(d,h,cb){
    var path =cf.path_shop+"/getNewUserVipCouponByCouponId?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("获取新人专享优惠券详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("获取新人专享优惠券详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//购买新人专享优惠券
exports.buyNewUserVipCoupon = function(d,h,cb){
    var path =cf.path_shop+"/buyNewUserVipCoupon?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("购买新人专享优惠券：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("购买新人专享优惠券：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//获取拼团详情
exports.getCollageByCouponId = function(d,h,cb){
    var path =cf.path_shop+"/getCollageByCouponId?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("获取拼团详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("获取拼团详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购-购买拼团优惠券
exports.buyCollageByCouponId = function(d,h,cb){
    var path =cf.path_shop+"/buyCollageByCouponId?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购-购买拼团优惠券：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购-购买拼团优惠券：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购-拼团-订单详情
exports.getCollageByOrderNumber = function(d,h,cb){
    var path =cf.path_shop+"/getCollageByOrderNumber?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购-拼团-订单详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购-拼团-订单详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购-拼团
exports.buyCollageByOrderId = function(d,h,cb){
    var path =cf.path_shop+"/buyCollageByOrderId?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购-拼团：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购-拼团：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//获取爆款活动类型
exports.getLuckyBurst = function(d,h,cb){
    var path =cf.path_shop+"/getLuckyBurst?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("获取爆款活动类型：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("获取爆款活动类型：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//获取爆款活动-列表
exports.getLuckyBurstList = function(d,h,cb){
    var path =cf.path_shop+"/getLuckyBurstList?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("获取爆款活动-列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("获取爆款活动-列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购-购买爆款优惠券
exports.buyLuckyBurst = function(d,h,cb){
    var path =cf.path_shop+"/buyLuckyBurst?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购-购买爆款优惠券：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购-购买爆款优惠券：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购-爆款优惠-详情
exports.luckyBurstDetail = function(d,h,cb){
    var path =cf.path_shop+"/luckyBurstDetail?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购-爆款优惠-详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购-爆款优惠-详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购-爆款优惠-详情-分享
exports.luckyBurstDetailEx = function(d,h,cb){
    var path =cf.path_shop+"/luckyBurstDetailEx?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购-爆款优惠-详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购-爆款优惠-详情：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购-爆款优惠-看视频获取能量
exports.getLuckyBurstByAdv = function(d,h,cb){
    var path =cf.path_shop+"/getLuckyBurstByAdv?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购-爆款优惠-看视频获取能量：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购-爆款优惠-看视频获取能量：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购-爆款优惠-好友点赞获取能量
exports.getLuckyBurstByFriend = function(d,h,cb){
    var path =cf.path_shop+"/getLuckyBurstByFriend?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购-爆款优惠-好友点赞获取能量：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购-爆款优惠-好友点赞获取能量：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购-爆款优惠-好友点赞获取能量-分享
exports.getLuckyBurstByFriendEx = function(d,h,cb){
    var path =cf.path_shop+"/getLuckyBurstByFriendEx?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购-爆款优惠-好友点赞获取能量-分享：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购-爆款优惠-好友点赞获取能量-分享：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购-爆款优惠-助力好友
exports.getLuckyBurstFriends = function(d,h,cb){
    var path =cf.path_shop+"/getLuckyBurstFriends?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购-爆款优惠-助力好友：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购-爆款优惠-助力好友：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购-商品搜索历史
exports.shopSearchProductHistory = function(d,h,cb){
    var path =cf.path_shop+"/shopSearchProductHistory?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购-商品搜索历史：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购-商品搜索历史：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//搜索商品-提示框
exports.searchProduct = function(d,h,cb){
    var path =cf.path_shop+"/searchProduct?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("搜索商品-提示框：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("搜索商品-提示框：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//清空搜索历史
exports.emptySearchHistory = function(d,h,cb){
    var path =cf.path_shop+"/emptySearchHistory?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("清空搜索历史：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("清空搜索历史：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购-搜索-商品列表
exports.searchProductList = function(d,h,cb){
    var path =cf.path_shop+"/searchProductList?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购-搜索-商品列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购-搜索-商品列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//店铺页
exports.getShopById = function(d,h,cb){
    var path =cf.path_shop+"/getShopById?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("店铺页：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("店铺页：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//店铺信息
exports.getShopInfo = function(d,h,cb){
    var path =cf.path_shop+"/getShopInfo?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("店铺信息：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("店铺信息：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//店铺推荐商品
exports.getShopRemProduct = function(d,h,cb){
    var path =cf.path_shop+"/getShopRemProduct?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("店铺推荐商品：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("店铺推荐商品：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//店铺-商品页
exports.getShopProduct = function(d,h,cb){
    var path =cf.path_shop+"/getShopProduct?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("店铺-商品页：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("店铺-商品页：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//店铺-热销
exports.getShopProductByOrder = function(d,h,cb){
    var path =cf.path_shop+"/getShopProductByOrder?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("店铺-热销：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("店铺-热销：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//店铺-上新页
exports.getShopProductByCreate = function(d,h,cb){
    var path =cf.path_shop+"/getShopProductByCreate?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("店铺-上新页：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("店铺-上新页：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//店铺-收藏店铺
exports.collectShopById = function(d,h,cb){
    var path =cf.path_shop+"/collectShopById?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("店铺-收藏店铺：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("店铺-收藏店铺：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购-我的-商品-优惠券列表
exports.getMyCouponsByProductId = function(d,h,cb){
    var path =cf.path_shop+"/getMyCouponsByProductId?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购-我的-商品-优惠券列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购-我的-商品-优惠券列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐购-首页-底部商品列表
exports.bottomProductList = function(d,h,cb){
    var path =cf.path_shop+"/bottomProductList?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐购-首页-底部商品列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐购-首页-底部商品列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};